<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>生命周期</title>
    <script src="/js/vue.js"></script>  
</head>

<body>
    
    <div id ="app"></div>
    <p>{{msg}}</p>
    <script>
     
     let app = new Vue({
        el: '#app',
        data: {
            msg:'hello world'
        },
        methods: {
            show(){
                console.log('show');
            }
        },
        beforeCreate(){
            
            console.log("beforeCreate");
        },
        created(){
            
            console.log(this.msg);
            this.show();
            console.log("Create");
        },
        beforeMount(){

            console.log(document.getElementById("p").innerText);
            console.log("beforeMount");
        },
        mounted(){          
            console.log(document.getElementById("p").innerText);
            console.log("mounted");
        },
        beforeUpdate(){
            console.log(document.getElementById("p").innerText);
            console.log("update");
        },
        updated(){
            console.log(document.getElementById("p").innerText);
            console.log("updated");
        },
        beforeDestroy(){
            console.log("beforeDestory");
        },
        destroyed(){ 
            console.log("destoryed");
        }
     });

     app.$destroy()
    </script>
</body>

</html>